<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions"%>
<form id="pagerForm" method="post" action="schoolAction!schoolList.action">
	<input type="hidden" name="pageNum" value="${currentPage}" />
	<input type="hidden" name="numPerPage" value="${numPerPage}" />
	<input type="hidden" name="orderField" value="${param.orderField}" />
	<input type="hidden" name="orderDirection" value="${param.orderDirection}" />
</form>
<script src="script/js/YwSelectSchool.js" type="text/javascript" ></script>
<script type="text/javascript">
$(function(){
	$("#schoolName").SchoolLiList({
		spellAction    : "searchSchoolAction!fromNameSpell.action",
		areaCodeAction : "searchSchoolAction!fromAreaCode.action",
		hidSclid:"sclid",
		afterClick:function(li_schname,li_sclid){
			 $("#sclid").val(li_sclid);
		}
	});
});
		function update(sclid){
			var checkStatus=document.getElementById(sclid).value;
			var isuRoleCode=document.getElementById("isuRoleCode").value;
			var isuId=document.getElementById("isuId").value;
			var createOperId=document.getElementById("createOperId").value;
			if(isuRoleCode=='1001'){//如果登录人是总经理,都能进行修改
				document.getElementById("edit1").style.display="none";
				document.getElementById("edit2").style.display="none";
				document.getElementById("edit3").style.display="block";
			}else{//如果登录人不是总经理
				document.getElementById("edit3").style.display="none";
				if(isuId==createOperId){//如果是创建人
					if(checkStatus=="0"){
						document.getElementById("edit1").style.display="none";
						document.getElementById("edit2").style.display="block";
						return false;
					}else{
						document.getElementById("edit1").style.display="block";
						document.getElementById("edit2").style.display="none";
						return true;
						}
				}else{
						document.getElementById("edit1").style.display="block";
						document.getElementById("edit2").style.display="none";
				}
				
			}
		}
		function message(){
				alertMsg.info("您没有权限进行修改!");
		}
		function update1(x){
			alert(x);
			if(x==1){
				alert("false");
				return false;
			}else{
				return true;
			}
		}
	</script>
<div class="pageHeader">
	<form rel="pagerForm" onsubmit="return navTabSearch(this);" action="schoolAction!schoolList.action" method="post">
	<div class="searchBar">	
				<input type="hidden" name="sclid" id="sclid" value="${params['sclid']}"/>
		<ul class="searchContent">
				<label>所属地区：</label>
				<select
					name="areaCode" 
					class="combox" id="area_county">
					<option value="">---所有地区---</option>
					<c:forEach items="${application.areaList}" var="area">
						<option ${areaCode==area.areaCode?"selected":""}  value="${area.areaCode }">${area.areaName}</option>
					</c:forEach>
				</select><label>部&nbsp;&nbsp;门：</label><select name="deptCode" id="deptCode" class="combox" ref="deptCode_saler"
														refUrl="school_getAllSaler.action?deptCode={value}">
									<option value="">---所有部门---</option>
									<c:forEach items="${deptList }" var="dept">
										<option ${deptCode==dept.deptCode?"selected":""} value="${dept.deptCode}">${dept.deptName}</option>
									</c:forEach>
							</select>
			<label>市场部门：</label> 
			<select name="deptId"  class="combox">
				       <option value="">---全部---</option>
				       <c:forEach items="${departmentList}" var="dept">
				             <option value="${dept.deptCode}" <c:if test="${deptId==dept.deptCode}">selected</c:if>>${dept.deptName}</option>
				       </c:forEach>
				       <option value="no" <c:if test="${params['deptNo']=='no'}">selected</c:if>>未绑定销售人员</option>
				</select>
			<label>结算方式：</label> 
			<select name="hsSchoolRelation.balanceTypeFlag"  class="combox">
				       <option value="">---全部---</option>
				       <c:forEach items="${balanceTypeFlagList}" var="dic">
				       		<option value="${dic.dicCode}" <c:if test="${hsSchoolRelation.balanceTypeFlag eq dic.dicCode}">selected</c:if>>${dic.dicName }</option>
				       </c:forEach>
				</select>
			<label>学校名称：</label> 
			<input type="text" name="hsSchoolInfo.sclName" id="schoolName" value="${hsSchoolInfo.sclName}"/>
			<input type="hidden" name="hsSchoolInfo.sclid" id="sclid" value="${params['sclid']}"/>
		</ul>
		<div class="subBar">
			<ul>
				<li><div class="buttonActive"><div class="buttonContent"><button type="submit">检索</button></div></div></li>
			</ul>
		</div>
	</div>

	</form>
</div>
<div class="pageContent">
	<div class="panelBar">
		<ul class="toolBar">
			<li><a class="add" href="schoolAction!skipAddSchool.action" target="navTab" rel="addschool" title="新增学校"><span>新增</span></a></li>
			<li><a id="edit2" href="schoolAction!editSchoolUi.action?id={sid_user}&flag=1" class="edit"   target="navTab" warn="请选择一条信息" rel="school_edit" style="display:bolck;"><span>修改</span></a>
				<a id="edit1"  class="edit"   warn="请选择一条信息" rel="school_edit" style="display:none;" onclick="message();"><span>修改</span></a>
				<a id="edit3" href="schoolAction!editSchoolUi.action?id={sid_user}&flag=0" class="edit"   target="navTab" warn="请选择一条信息" rel="school_edit" style="display:none;"><span>修改</span></a>
			</li>
			<!-- <li><a  href="schoolAction!editSchoolUi.action?id={sid_user}" target="_blank" warn="请选择一条信息" rel="school_edit" onclick="return update1(1);"><span>修改</span></a></li> -->
			<!-- <li><input type="checkbox" class="checkboxCtrl" group="sclids" />全选<button type="button" class="checkboxCtrl" group="sclids" selectType="invert">反选</button></li> -->
			<li class="line">line</li>
			<!-- <li><a class="icon" href="demo/common/dwz-team.xls" target="dwzExport" targetType="navTab" title="实要导出这些记录吗?"><span>导出EXCEL</span></a></li> -->
		</ul>
	</div>
<div layoutH="120">


<form  rel="pageForm"  onsubmit="return navTabSearch(this);"  action="schoolAction!schoolList.action" method="post">
<table class="list" width="98%">

      <thead>

           <thead>
						<tr>
								<!-- <th>
									选择
								</th> -->
							<th>
								序号
							</th>
							<th>
								地区
							</th>
							<th>
								学校名称
							</th>
							<th>
								集团客户ID
							</th>
							<th>
								卡类型
							</th>
							<th>
								移动客户经理
							</th>
							<th>
								销售人员
							</th>
							<th>
								激励方式
							</th>
							<th>
								结算方式
							</th>
							<th>
								审核状态
							</th>
							<c:if test="${currentUser.insideUser.isuRoleCode eq '1001' }">
							<th>
								操作
							</th>
							</c:if>
						</tr>
					</thead>
<tbody>
						<c:forEach items="${recordList}" var="school"
							varStatus="i">
							<tr target="sid_user" rel="${school.sclId}" onclick="update('${school.sclId}');">
								<%-- <td>
									<input type="checkbox" name="sclids" value="${school.sclId }"/>
									
								</td> --%>
								<td>
								<input type="hidden"  id="isuId" value="${currentUser.userId}">
								<input type="hidden"  id="isuRoleCode" value="${currentUser.insideUser.isuRoleCode}">
								<input type="hidden"  id=createOperId value="${scList[school.sclId]['relation'].createOperId}">
								<input type="hidden" name="checkStatusFlag" id="${school.sclId}" value="${school.checkStatusFlag}"/>
									${(i.index+1) + (currentPage-1) * pageSize}
								</td>
								<td>
								   	 ${scList[school.sclId]["area"].areaName}
								</td>
								<td>
									 ${school.sclName}
								</td>
								<td>
									 <c:if test="${scList[school.sclId]['ec'] eq null}">
									 <a href="schoolAction!addBossEcUi.action?id=${school.sclId }" target="dialog" rel="addBossEc">绑定</a></c:if>
									  ${scList[school.sclId]['ec'].ecId}
								</td>
								<td>
									<c:if test="${scList[school.sclId]['relation'].cardTypeFlag eq '1'}">M1</c:if>
									<c:if test="${scList[school.sclId]['relation'].cardTypeFlag eq '0'}">FR</c:if>
								</td>
								<td>
									 ${scList[school.sclId]["mobManager"].osuName}
								</td>
								<td>
									 ${scList[school.sclId]["sale"].isuName}
								</td>
								<td>
									<c:forEach items="${marketingTypeFlagList}" var="dic">
										<c:if  test="${scList[school.sclId]['relation'].marketingTypeFlag eq dic.dicCode}">
									   ${dic.dicName }
									 </c:if>
									</c:forEach>
								</td>
								<td>
									<c:forEach items="${balanceTypeFlagList}" var="dic">
										<c:if  test="${scList[school.sclId]['relation'].balanceTypeFlag eq dic.dicCode}">
									   ${dic.dicName }
									 </c:if>
									</c:forEach>
									 
								</td>
								<td>
									<c:if  test="${school.checkStatusFlag=='0'}">
									        未审核
									 </c:if>
									 <c:if  test="${school.checkStatusFlag=='1'}">
									       审核通过
									 </c:if>
								</td>
								<%-- <td>
								  <c:if test="${school.checkStatusFlag eq '1' }">
									<a class="btn btn-info"
										href="schoolAction!editSchoolUi.action?id=${school.sclId }"
										target="navTab" rel="school_edit11">修改</a>
								  </c:if>
									<a class="btn btn-danger" href="schoolAction!deleteSchool.action?id=${school.sclId }"
										target="ajaxTodo" title="确定要删除该学校吗">删除</a>
										
								</td> --%>
								<c:if test="${currentUser.insideUser.isuRoleCode eq '1001' }">
								<td>
									<c:if test="${school.checkStatusFlag=='0'}">
									<a class="btn btn-info"
										href="schoolAction!editSchoolUi.action?id=${school.sclId }&flag=2"
										target="navTab" rel="school_edit11" title="审核">审核</a>
									</c:if>
								</td>
								</c:if>
							</tr>
						</c:forEach>
					</tbody>

      </tbody>

</table>
</form>


</div>
<div class="panelBar"> 
 <div class="pages">   
 <span>显示</span>   
 <select class="combox" name="numPerPage" onchange="navTabPageBreak({numPerPage:this.value})">    
      <option value="10" <c:if test="${pageSize==10}">selected</c:if>>10</option>    
      <option value="20" <c:if test="${pageSize==20}">selected</c:if>>20</option>    
      <option value="30" <c:if test="${pageSize==30}">selected</c:if>>30</option>    
      <option value="50" <c:if test="${pageSize==50}">selected</c:if>>50</option>    
      <option value="100" <c:if test="${pageSize==100}">selected</c:if>>100</option>   
  </select>   <span>条，共${recordCount}条</span>  </div>  <!--分页组件-->  
  <div class="pagination" targetType="navTab" totalCount="${recordCount}" numPerPage="${pageSize}" pageNumShown="${pageNumShown}" currentPage="${currentPage}">
  </div> 
  </div>
<%@ include file="/WEB-INF/jsp/public/proSchool.jsp"%>
